//
//  AppDelegate+QSBasicSetting.swift
//  TestSwift
//
//  Created by Song on 2018/3/2.
//  Copyright © 2018年 Song. All rights reserved.
//

import Foundation
import UIKit

import IQKeyboardManager

extension AppDelegate {
    /// 设置根控制器
    ///
    /// - Parameter rootVc: 根控制器
    func qs_setRootViewController(rootVc : UIViewController) -> Void {
        self.window = UIWindow.init(frame: UIScreen.main.bounds)
        self.window?.backgroundColor = UIColor.white
        
        self.window?.rootViewController = rootVc
        self.window?.makeKeyAndVisible()
    }
    
    /// 设置键盘
    func qs_setKeyboard() -> Void {
        let mamager : IQKeyboardManager = IQKeyboardManager.shared()
        mamager.isEnabled = true
        mamager.shouldResignOnTouchOutside = true
        mamager.shouldToolbarUsesTextFieldTintColor = true
        mamager.shouldShowToolbarPlaceholder = true
        mamager.isEnableAutoToolbar = true
    }
    
    /// 设置状态栏
    ///
    /// - Parameter style: 状态栏样式
    func qs_setStateBarStytle(_ style : UIStatusBarStyle) -> Void {
        UIApplication.shared.setStatusBarStyle(style, animated: false)
        // 启动时隐藏状态栏
        UIApplication.shared.setStatusBarHidden(false, with: UIStatusBarAnimation.fade)
    }
}
